


setInterval(() => {
    throttle(fn, 1000)
    // fn()
}, 500)

function fn() {
    console.log(1)
}

const throttle = (cb, time) => {
    let timer = null
    return function (...args) {
        let _this = this;
        if (timer) {
            return
        }
        timer = setTimeout(() => {
            cb.apply(_this, args)
            timer = null
        }, time)
    }
}

